/* $Header: flash.h,v 2.2 01/10/02 10:30:21 przybyls Exp $ */

/***********************************************************************/
/* INCLUDE FILE NAME:  flash.h                                         */
/* ==================                                                  */
/*                                                                     */
/* Author:  Paul Dryden                                                */
/*                                                                     */
/* COMMENT:                                                            */
/*                                                                     */
/*                                                                     */
/*                                                                     */
/*                                                                     */
/***********************************************************************/

#ifndef FLASH_H
#define FLASH_H

/*****************************/
/*   IFDEFS                  */
/*****************************/


/*****************************/
/*   SYMBOLIC CONSTANTS      */
/*****************************/

#define  FLASH1_START          0x00000000
#define  FLASH1_SIZE           0x00200000
#define  FLASH2_START          0x00200000
#define  FLASH2_SIZE           0x00100000
#define  EXCEPTION_LOG1_START  FLASH2_START + 0x000d0000
#define  EXCEPTION_LOG2_START  FLASH2_START + 0x000e0000
#define  EXCEPTION_LOG_SIZE   0x00010000

#define  FLASH_DATA_BASE     33
#define  FLASH_DATA_MOD      85
#define  FLASH_DATA_MAX      FLASH_DATA_BASE + FLASH_DATA_MOD - 1
#define  FLASH_DATA_OVFL1    0x03030303
#define  FLASH_DATA_OVFL2    0

#define ADLER_MOD            65521

#define FLASH_BUF_AVAIL      0xFFFF


/*****************************/
/*   MACROS                  */
/*****************************/


/*****************************/
/*   TYPEDEFS                */
/*****************************/



/*****************************/
/*   EXTERNALS               */
/*****************************/


/*****************************/
/*   FUNCTION PROTOTYPES     */
/*****************************/

#pragma  SECTION PROG=boot

void     InitializeFlash (void);
UI_ERR   EraseFlashBuffer (INT32 compressed_count, INT32 expanded_count, U_INT16 comm_port);
UI_ERR   ProgramFlashBuffer (BIT8 *prog_data, U_INT16 comm_port);
UI_ERR   CheckFlashBuffer (U_INT16 comm_port);
UI_ERR   InstallFlashBuffer (FLASH_DATA_TYPE *p);
void     EraseFlash2 (void);
void     UpdateExceptionLog (void);
INT16    DoGCES (CMD_TYPE *p_cmd, BIT8 *p_resp_parm);
INT16    DoGCEL (CMD_TYPE *p_cmd, BIT8 *p_resp_parm);
INT16    DoGCEA (CMD_TYPE *p_cmd, BIT8 *p_resp_parm);
INT16    DoGCED (CMD_TYPE *p_cmd, BIT8 *p_resp_parm);
UI_ERR   DeleteExceptionLog(void);
void     BackUpMfgRAM (void);
void     InvalidateMfgBackup(void);
void     ForceServiceLog (U_INT16 exception);

#pragma  SECTION UNDO

#endif
